package com.tbfs.admin.dao;

import java.util.List;

import com.tbfs.admin.vo.UserRole;
import com.tbfs.admin.vo.Userinfo;
import com.tbfs.common.AbsBaseDaoImpl;

public class UserinfoDAO extends AbsBaseDaoImpl{

	@Override
	protected String getInsertSql() {
		return "qn_db_userinfo.abatorgenerated_insert";
	}

	@Override
	protected String getUpdateByPrimaryKeySql() {
		return "qn_db_userinfo.abatorgenerated_updateByPrimaryKey";
	}

	@Override
	protected String getUpdateByPrimaryKeySelectiveSql() {
		return "qn_db_userinfo.abatorgenerated_updateByPrimaryKeySelective";
	}

	@Override
	protected String getDeleteByPrimaryKeySql() {
		return "qn_db_userinfo.abatorgenerated_deleteByPrimaryKey";
	}

	@Override
	protected String getQueryBySelectiveSql() {
		// TODO Auto-generated method stub
		return "qn_db_userinfo.select_alluserinfo_sql";
	}

	@Override
	protected String getQueryBySelectiveCountSql() {
		// TODO Auto-generated method stub
		return "qn_db_userinfo.select_alluserinfo_rows_sql";
	}

	@Override
	protected String getSelectByEntityIdSql() {
		// TODO Auto-generated method stub
		return null;
	}

	public Userinfo getLoginUserInfo(Userinfo bean){
		Userinfo userinfo = (Userinfo)getSqlMapClientTemplate().queryForObject("qn_db_userinfo.select_userinfo_sql",bean);
		return userinfo;
	}

	public void modify(Userinfo userinfo){
		getSqlMapClientTemplate().insert("qn_db_userinfo.abatorgenerated_insert", userinfo);
	}
	
	public void insertUserRole(UserRole userRole){
		getSqlMapClientTemplate().insert("qn_db_userinfo.abatorgenerated_user_role_insert", userRole);
	}
	/**
	 * 查询用户的角色
	 * @param userRole
	 * @return
	 */
	public List queryUserRoleList(UserRole userRole){
		return getSqlMapClientTemplate().queryForList("qn_db_userinfo.abatorgenerated_user_role_select", userRole);
	}
  
}